package com.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.common.utils.PageUtils;
import com.common.utils.Query;
import com.dao.JudgeQuestionDao;
import com.entity.JudgeQuestionEntity;
import com.service.JudgeQuestionService;
import org.aspectj.lang.annotation.AfterThrowing;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("judgeQuestionService")
public class JudgeQuestionServiceImpl extends ServiceImpl<JudgeQuestionDao, JudgeQuestionEntity> implements JudgeQuestionService {

    @Autowired
    private JudgeQuestionDao judgeQuestionDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<JudgeQuestionEntity> page = this.page(
                new Query<JudgeQuestionEntity>().getPage(params),
                new QueryWrapper<JudgeQuestionEntity>()
                        .or().like("questionid",params.get("key"))
                        .or().like("subject",params.get("key"))
                        .or().like("level",params.get("key"))
                        .or().like("section",params.get("key"))
        );

        return new PageUtils(page);
    }

    @Override
    public List<JudgeQuestionEntity> getAllList() {
        return judgeQuestionDao.selectList(new QueryWrapper<>());
    }

}